import { fetchTopics, fetchTopicDetail } from '../api'

export default {
  FETCH_TOPICS_LIST: ({ commit, state }, { data }) => {
    let url = '/retrieve/getAnswer'
    return fetchTopics(data, url).then(res =>
      commit('SET_TOPICS_LIST', { list: res.data.data })
    )
  },
  FETCH_TOPIC_DETAIL: ({ commit }, data) => {
    return fetchTopicDetail(data).then(res =>
      commit('SET_TOPIC_DETAIL', { detail: res.data.data.data[0] })
    )
  }
}
